From: Florian Müllner Date: Thu, 14 Jan 2021 15:58:20 +0000 (+0100) Subject: st/scroll-view-fade: Don't assume fade area at (0,0) X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~616^2^2~599 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=5d65a424a8eecc3ffc88d028db71cd9f8bd9158c;p=gnome-shell.git st/scroll-view-fade: Don't assume fade area at (0,0) The shader code currently only accounts for padding for the bottom and right fades, but not for top and left. As a result, we only fade the right edge when swiping through app picker pages, whoops. Part-of: --- diff --git a/src/st/st-scroll-view-fade.glsl b/src/st/st-scroll-view-fade.glsl index 9180aa184..2eacfd9af 100644 --- a/src/st/st-scroll-view-fade.glsl +++ b/src/st/st-scroll-view-fade.glsl @@ -44,16 +44,18 @@ void main () if (x > fade_area_topleft[0] && x < fade_area_bottomright[0] && y > fade_area_topleft[1] && y < fade_area_bottomright[1]) { float ratio = 1.0; + float fade_top_start = fade_area_topleft[1] + vfade_offset; + float fade_left_start = fade_area_topleft[0] + hfade_offset; float fade_bottom_start = fade_area_bottomright[1] - vfade_offset; float fade_right_start = fade_area_bottomright[0] - hfade_offset; bool fade_top = y < vfade_offset && fade_edges_top; bool fade_bottom = y > fade_bottom_start && fade_edges_bottom; - bool fade_left = x < hfade_offset && fade_edges_left; + bool fade_left = x < fade_left_start && fade_edges_left; bool fade_right = x > fade_right_start && fade_edges_right; float vfade_scale = height / vfade_offset; if (fade_top) { - ratio *= y / vfade_offset; + ratio *= (fade_area_topleft[1] - y) / (fade_area_topleft[1] - fade_bottom_start); } if (fade_bottom) { @@ -62,7 +64,7 @@ void main () float hfade_scale = width / hfade_offset; if (fade_left) { - ratio *= x / hfade_offset; + ratio *= (fade_area_topleft[0] - x) / (fade_area_topleft[0] - fade_left_start); } if (fade_right) {